package singleton;

/**
 * 双重检验锁单例模式--线程安全
 */
public class Singleton_1 {

    private static Singleton_1 singleton;

    private Singleton_1(){

    }

    public static Singleton_1 getInstance(){
        if (singleton == null){
            synchronized (Singleton_1.class){
                if (singleton == null){
                    singleton = new Singleton_1();
                }
            }
        }
        return singleton;
    }
}
